import createjs from "createjs-ts"
import cjs=createjs;
import LoadController from "./app/LoadController"
import LayerController from "./LayerController"
import BaseController from "./BaseController"
import MessageController from "./MessageController"
import MainController from "./app/MainController"
import { GameEvent } from "../events/GameEvent"
/**
 * 游戏控制器
 */
export default class GameController extends BaseController {
    /**
     * 加载控制器
     */
    private load:LoadController=new LoadController();
    //private share:ShareObject=new ShareObject();
    //private root:cjs.Container;
    init(root:cjs.Container):void{
        this.root=root;
        this.layer=new LayerController();
        this.layer.init(root);
        this.message=new MessageController();
        const option={
            root:root,
            layer:this.layer,
            message:this.message
        };
        //加载
        this.load.init(option);
        this.load.start()
        //主界场景
        const main=new MainController();
        main.init(option);
        main.start();
        //游戏加载
        //this.message.send(GameEvent.GAME_LOADING)
        
    }
    start(): void {
        //开始游戏
        this.message.send(GameEvent.GAME_START)
        
    }
}